home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Languages / Quick C 2.0 / INCLUDE / PGCHART.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-13  |  8.5 KB  |  226 lines

  1. /***
  2. *pgchart.h - Declare constants, functions and macros for charting library.
  3. *
  4. *  Copyright (c) 1988-1989, Microsoft Corporation, All rights reserved.
  5. *
  6. *Purpose:
  7. *  This file declares the presentation graphics library functions and
  8. *  the structures and manifest constants that are used with them.
  9. *
  10. ***************************************************************************/
  11.  
  12. #ifndef NO_EXT_KEYS /* extensions enabled */
  13.     #define _CDECL    cdecl
  14.     #define _FAR    far
  15. #else /* extensions not enabled */
  16.     #ifdef M_I86LM /* large model */
  17.     #define _CDECL
  18.     #define _FAR
  19.     #else
  20.     #error -Za requires -AL when using pgchart.h
  21.     #endif /* M_I86LM */
  22. #endif /* NO_EXT_KEYS */
  23.  
  24. /* Required for the missing value definition */
  25. #define FLT_MAX            3.402823466e+38        /* max value */
  26.  
  27. #define _PG_PALETTELEN        16    /* Number of entries in internal palette */
  28. #define _PG_MAXCHARTTYPE    5    /* Maximum available chart type */
  29. #define _PG_MAXCHARTSTYLE    2    /* Maximum chart style */
  30. #define _PG_TITLELEN        70    /* Maximum title text length */
  31.  
  32. #define _PG_LEFT        1    /* Positions used for titles and legends */
  33. #define _PG_CENTER        2
  34. #define _PG_RIGHT        3
  35. #define _PG_BOTTOM        4
  36. #define _PG_OVERLAY        5
  37.  
  38. #define _PG_LINEARAXIS        1    /* Used to specify axis types */
  39. #define _PG_LOGAXIS        2
  40.  
  41. #define _PG_DECFORMAT        1    /* Used to specify tic mark label format */
  42. #define _PG_EXPFORMAT        2
  43.  
  44. #define _PG_BARCHART        1    /* Charttype for a bar chart */
  45. #define _PG_COLUMNCHART        2    /* Charttype for a column chart */
  46. #define  _PG_PLAINBARS        1    /* Styles for bar and column charts */
  47. #define  _PG_STACKEDBARS    2
  48.  
  49. #define _PG_LINECHART        3    /* Charttype for a line chart */
  50. #define _PG_SCATTERCHART    4    /* Charttype for a scatter chart */
  51. #define _PG_POINTANDLINE    1    /* Styles for line and scatter charts */
  52. #define _PG_POINTONLY        2
  53.  
  54. #define _PG_PIECHART        5    /* Charttype for pie chart */
  55. #define _PG_PERCENT        1    /* Styles for pie charts */
  56. #define _PG_NOPERCENT        2
  57.  
  58. #define _PG_MISSINGVALUE    -FLT_MAX    /* Indicates missing data values */
  59.  
  60. /* Error codes    */
  61.  
  62. /* Numbers greater than 100 will terminate chart routine, others will cause
  63.  * default values to be used
  64.  */
  65. #define    _PG_NOTINITIALIZED    102    /* If library not initialized */
  66. #define    _PG_BADSCREENMODE    103    /* Graphics mode not set before charting */
  67. #define    _PG_BADCHARTSTYLE    04    /* Chart style invalid */
  68. #define    _PG_BADCHARTTYPE    104    /* Chart type invalid */
  69. #define    _PG_BADLEGENDWINDOW    105    /* Invalid legend window specified */
  70. #define    _PG_BADCHARTWINDOW    07    /* x1=x2 or y1=y2 in chart window spec. */
  71. #define    _PG_BADDATAWINDOW    107    /* If chart window is too small */
  72. #define    _PG_NOMEMORY        108    /* Not enough memory for data arrays */
  73. #define    _PG_BADLOGBASE        05    /* Log base <= 0 */
  74. #define    _PG_BADSCALEFACTOR    06    /* Scale factor = 0 */
  75. #define    _PG_TOOSMALLN        109    /* Number of data points <= 0 */
  76. #define    _PG_TOOFEWSERIES    110    /* Number of series <= 0 */
  77.  
  78. /* Typedefs    */
  79.  
  80. /* Typedef for chart title */
  81. #ifndef _TITLETYPE_DEFINED
  82. typedef    struct    {
  83.     char    title[_PG_TITLELEN];    /* Title text */
  84.     short    titlecolor;        /* Internal palette color for title text */
  85.     short    justify;        /* _PG_LEFT, _PG_CENTER, _PG_RIGHT */
  86. } titletype;
  87. #define _TITLETYPE_DEFINED
  88. #endif
  89.  
  90. /* Typedef for chart axes */
  91. #ifndef _AXISTYPE_DEFINED
  92. typedef    struct    {
  93.     short        grid;        /* TRUE=grid lines drawn; FALSE no lines */
  94.     short        gridstyle;    /* Style number from style pool for grid lines */
  95.     titletype    axistitle;    /* Title definition for axis */
  96.     short        axiscolor;    /* Color for axis */
  97.     short        labeled;    /* TRUE=tic marks and titles drawn */
  98.     short        rangetype;    /* _PG_LINEARAXIS, _PG_LOGAXIS */
  99.     float        logbase;    /* Base used if log axis */
  100.     short        autoscale;    /* TRUE=next 7 values calculated by system */
  101.     float        scalemin;    /* Minimum value of scale */
  102.     float        scalemax;    /* Maximum value of scale */
  103.     float        scalefactor;    /* Scale factor for data on this axis */
  104.     titletype    scaletitle;    /* Title definition for scaling factor */
  105.     float        ticinterval;    /* Distance between tic marks (world coord.) */
  106.     short        ticformat;    /* _PG_EXPFORMAT or _PG_DECFORMAT for tic labels */
  107.     short        ticdecimals;    /* Number of decimals for tic labels (max=9)*/
  108. } axistype;
  109. #define _AXISTYPE_DEFINED
  110. #endif
  111.  
  112. /* Typedef used for defining chart and data windows */
  113. #ifndef _WINDOWTYPE_DEFINED
  114. typedef    struct    {
  115.     short        x1;        /* Left edge of window in pixels */
  116.     short        y1;        /* Top edge of window in pixels */
  117.     short        x2;        /* Right edge of window in pixels */
  118.     short        y2;        /* Bottom edge of window in pixels */
  119.     short        border;        /* TRUE for border, FALSE otherwise */
  120.     short        background;    /* Internal palette color for window bgnd */
  121.     short        borderstyle;    /* Style bytes for window border */
  122.     short        bordercolor;    /* Internal palette color for window border */
  123. } windowtype;
  124. #define _WINDOWTYPE_DEFINED
  125. #endif
  126.  
  127. /* Typedef for legend definition */
  128. #ifndef _LEGENDTYPE_DEFINED
  129. typedef struct    {
  130.     short        legend;        /* TRUE=draw legend; FALSE=no legend */
  131.     short        place;        /* _PG_RIGHT, _PG_BOTTOM, _PG_OVERLAY */
  132.     short        textcolor;    /* Internal palette color for text */
  133.     short        autosize;    /* TRUE=system calculates size */
  134.     windowtype    legendwindow;    /* Window definition for legend */
  135. } legendtype;
  136. #define _LEGENDTYPE_DEFINED
  137. #endif
  138.  
  139. /* Typedef for legend definition */
  140. #ifndef _CHARTENV_DEFINED
  141. typedef struct    {
  142.     short        charttype;    /* _PG_BAR, _PG_COLUMN, _PG_LINE, _PG_SCATTER, _PG_PIE */
  143.     short        chartstyle;    /* Style for selected chart type */
  144.     windowtype    chartwindow;    /* Window definition for overall chart */
  145.     windowtype    datawindow;    /* Window definition for data part of chart */
  146.     titletype    maintitle;    /* Main chart title */
  147.     titletype    subtitle;    /* Chart sub-title */
  148.     axistype    xaxis;        /* Definition for X-axis */
  149.     axistype    yaxis;        /* Definition for Y-axis */
  150.     legendtype    legend;        /* Definition for legend */
  151. } chartenv;
  152. #define _CHARTENV_DEFINED
  153. #endif
  154.  
  155. /* Typedef for character bitmap */
  156. #ifndef _CHARMAP_DEFINED
  157. typedef unsigned char charmap[8];
  158. #define _CHARMAP_DEFINED
  159. #endif
  160.  
  161. /* Typedef for pattern bitmap */
  162. #ifndef _FILLMAP_DEFINED
  163. typedef unsigned char fillmap[8];
  164. #define _FILLMAP_DEFINED
  165. #endif
  166.  
  167. /* Typedef for palette entry definition */
  168. #ifndef _PALETTEENTRY_DEFINED
  169. typedef struct {
  170.     unsigned short    color;
  171.     unsigned short    style;
  172.     fillmap        fill;
  173.     char        plotchar;
  174. } paletteentry;
  175. #define _PALETTEENTRY_DEFINED
  176. #endif
  177.  
  178. /* Typedef for palette definition */
  179. #ifndef _PALETTETYPE_DEFINED
  180. typedef paletteentry palettetype[_PG_PALETTELEN];
  181. #define _PALETTETYPE_DEFINED
  182. #endif
  183.  
  184. /* Typedef for style sets */
  185. #ifndef _STYLESET_DEFINED
  186. typedef unsigned short styleset[_PG_PALETTELEN];
  187. #define _STYLESET_DEFINED
  188. #endif
  189.  
  190. /* Function prototypes for charting routines    */
  191.  
  192. short _FAR _CDECL _pg_initchart(void);
  193. short _FAR _CDECL _pg_defaultchart(chartenv _FAR *, short, short);
  194.  
  195. short _FAR _CDECL _pg_chart(chartenv _FAR *, char _FAR * _FAR *, float _FAR *, short);
  196. short _FAR _CDECL _pg_chartms(chartenv _FAR *, char _FAR * _FAR *, float _FAR *, short, short, short, char _FAR * _FAR *);
  197.  
  198. short _FAR _CDECL _pg_chartscatter(chartenv _FAR *, float _FAR *, float _FAR *, short);
  199. short _FAR _CDECL _pg_chartscatterms(chartenv _FAR *, float _FAR *, float _FAR *, short, short, short, char _FAR * _FAR *);
  200.  
  201. short _FAR _CDECL _pg_chartpie(chartenv _FAR *, char _FAR * _FAR *, float _FAR *, short _FAR *, short);
  202.  
  203. /* Function prototypes for support routines    */
  204.  
  205. short _FAR _CDECL _pg_hlabelchart(chartenv _FAR *, short, short, short, char _FAR *);
  206. short _FAR _CDECL _pg_vlabelchart(chartenv _FAR *, short, short, short, char _FAR *);
  207.  
  208. short _FAR _CDECL _pg_analyzechart(chartenv _FAR *, char _FAR * _FAR *, float _FAR *, short);
  209. short _FAR _CDECL _pg_analyzechartms(chartenv _FAR *, char _FAR * _FAR *, float _FAR *, short, short, short, char _FAR * _FAR *);
  210.  
  211. short _FAR _CDECL _pg_analyzescatter(chartenv _FAR *, float _FAR *, float _FAR *, short);
  212. short _FAR _CDECL _pg_analyzescatterms(chartenv _FAR *, float _FAR *, float _FAR *, short, short, short, char _FAR * _FAR *);
  213.  
  214. short _FAR _CDECL _pg_analyzepie(chartenv _FAR *, char _FAR * _FAR *, float _FAR *, short _FAR *, short);
  215.  
  216. short _FAR _CDECL _pg_getpalette(paletteentry _FAR *);
  217. short _FAR _CDECL _pg_setpalette(paletteentry _FAR *);
  218. short _FAR _CDECL _pg_resetpalette(void);
  219.  
  220. void  _FAR _CDECL _pg_getstyleset(unsigned short _FAR *);
  221. void  _FAR _CDECL _pg_setstyleset(unsigned short _FAR *);
  222. void  _FAR _CDECL _pg_resetstyleset(void);
  223.  
  224. short _FAR _CDECL _pg_getchardef(short, unsigned char _FAR *);
  225. short _FAR _CDECL _pg_setchardef(short, unsigned char _FAR *);
  226.